﻿@model List<Model.Sys.RoleDBInfo>
<script type="text/javascript">
    function select_All(n) {
        var ck = false;
        if ($('.' + n + 'All')[0].checked)
            ck = true;
        $('.' + n + '').each(function (i, d) {
            $(this)[0].checked = ck;
            if (ck)
                $(this).attr("checked", "checked");
            else
                $(this).removeAttr("checked");
        });
    } 
</script>
<table id="tbRoleDBConfig" class="pagTable" style="width: 100%;" border="0" cellpadding="0"
    cellspacing="0">
    <tr class="pagTablehd">
        <td style="width: 20px; text-align: center;">
            <label>
                <input type="checkbox" onclick="select_All('IsSelected');" class="IsSelectedAll" /> 
            </label>
        </td>
        <td style="width: 200px;">
            &nbsp;数据库名称
        </td> 
        <td style="width: 80px;text-align: center;" title="启用/禁用">
            <label>
                <input type="checkbox" onclick="select_All('IsEnable');" class="IsEnableAll" />启用/禁用</label>
        </td>
        <td style="width: 80px;text-align: center;" title="管理权限">
            <label>
                <input type="checkbox" onclick="select_All('IsManagement');" class="IsManagementAll" />管理权限</label>
        </td>
        <td style="width: 80px;text-align: center;" title="查看权限">
            <label>
                <input type="checkbox" onclick="select_All('IsView');" class="IsViewAll" />查看权限</label>
        </td> 
    </tr>
    @foreach (var dbItem in Model)
    {
        <tr>
            <td style="text-align: center;">
                <input name="selectdbitem"  type="checkbox" value="@(dbItem.DBId)" @(dbItem.Selected ? "checked" : "") class="IsSelected" />
            </td>
            <td title="@(dbItem.DBDisplayName)">
                &nbsp;@dbItem.DBDisplayName 
            </td> 
            <td style="text-align: center;">
                <input name="isEnable@(dbItem.DBId)" type="checkbox" value="1" @(dbItem.IsEnable.Equals(1) ? "checked" : "") class="IsEnable" />
            </td>
            <td style="text-align: center;">
                <input name="isManagement@(dbItem.DBId)" type="checkbox" value="1" @(dbItem.IsManagement.Equals(1) ? "checked" : "") class="IsManagement" />
            </td>
            <td style="text-align: center;">
                <input name="isView@(dbItem.DBId)" type="checkbox" value="1" @(dbItem.IsView.Equals(1) ? "checked" : "") class="IsView" />
            </td> 
        </tr>
    }
</table>
